package operation_system.philosopher_eating;

//死锁demo
public class DeadLockDemo {

    public static void main(String[] args) {
        Object[] objects = new Object[5];
        for (int i = 0; i < 5; i++) {
            objects[i] = new Object();
        }
        for (int i = 0; i < 5; i++) {
            if (i < 4) {
                new Thread(new AEatAndThink(objects[i], objects[i + 1])).start();
            }else{
                new Thread(new AEatAndThink(objects[i], objects[0])).start();
            }
        }
    }
}

